﻿#define _CRT_SECURE_NO_WARNINGS 1
#include "unordermap.h"
#include "unorderset.h"

void test_map()
{
	unordered_map<string, string> dict;
	dict.insert(make_pair("sort", ""));
	dict.insert(make_pair("left", ""));
	dict.insert(make_pair("left", "dd"));
	dict["string"];
	dict["left"] = "fd";
	dict["string"] = "";

	unordered_map<string, string>::iterator it = dict.begin();
	while (it != dict.end())
	{
		cout << it->first << " " << it->second << endl;
		++it;
	}

	cout << endl;

	for (auto& kv : dict)
	{
		cout << kv.first << " " << kv.second << endl;
	}
}
int main()
{
	unordered_set <int>  set;
	set.insert(1);
	set.insert(2);
	set.insert(54);
	set.insert(67);
	set.insert(655);
	set.insert(987);

	unordered_set<int>::iterator it = set.begin();

	while (it!=set.end())
	{
		cout << it._Node->_data << endl;
		it = set.erase(it._Node->_data);		//迭代器失效

	}
	cout << endl;
	unordered_set<int>::iterator it1 = set.find(1);
	if (it1._Node == nullptr)
	{
		cout << "没找到" << endl;
	}
	for (auto& e : set)
	{
		cout << e << " ";
	}
	

	return 0;

}